<?php
header("Content-Type: text/html; charset=gbk");
require '../../packages/connect_database.php';
mysql_select_db("user");
$query = null;
$result = null;
$count = 0;
if($_GET["state"] != 2) {
	$query = mysql_query("SELECT COUNT(*) FROM _" . $_COOKIE["phone"] . " WHERE read_already = " . $_GET["state"]);
	$result = mysql_fetch_row($query);
	$count = $result[0];
	$query = mysql_query("SELECT message_text,message_time FROM _" . $_COOKIE["phone"] . " WHERE read_already = " . $_GET["state"]);
	$result = mysql_fetch_row($query);
}
else {
	$query = mysql_query("SELECT COUNT(*) FROM _" . $_COOKIE["phone"]);
	$result = mysql_fetch_row($query);
	$count = $result[0];
	$query = mysql_query("SELECT message_text,message_time FROM _" . $_COOKIE["phone"]);
	$result = mysql_fetch_row($query);
}
$message_list = "";
for($i = 0;$i < $count;$i++) {
	$message_list .= ($result[0] . "<fenge>" . $result[1] . "<record>");
	$result = mysql_fetch_row($query);
}
echo $message_list;
